<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        // 方法
        // 添加元素 push unshift
        // 删除
        Array.prototype.sum = function(){
            console.log(this);
            var total = 0;
            for(var i=0;i<this.length;i++){
                total+=this[i];
            }
            return total;
        }
        console.log(Array.prototype);
        var arr = [7,9,8];
        var t = arr.sum();
        console.log(t);


   </script>
</body>
</html>